#include <iostream>
#include <cstdlib>
using namespace std;
int main(void){
	
	int a = 100;
	double a1 = (double)a; //c风格
	double a2 = double(a);//C++风格

	double b = static_cast<double>(a);
	
	void *p = malloc(100);
	//void * 和 其他类型的指针转换
	int *pi = static_cast<int *>(p);
	char *pc = static_cast<char *>(p);
	//error: invalid ‘static_cast’ from type ‘void*’ to type ‘int’
	//int num = static_cast<int>(p);
	//error: invalid ‘static_cast’ from type ‘char*’ to type ‘int*’
	//pi = static_cast<int *>(pc);
	return 0;
}
